const path = require("path")
const DllPlugin = require("webpack/lib/DllPlugin");

const resolve = filePath => path.resolve(__dirname, '../', filePath)

module.exports = {
    mode: "production",
    entry: {
        vendor: [
            'file-saver',
            'exceljs',
            "plain-ui-composition",
            "plain-ui",
            "markdown-it",
            "markdown-it-attrs",
            "markdown-it-container",
            "markdown-it-emoji",
        ],
    },
    resolve: {
        alias: {}
    },
    output: {
        path: resolve('dll'),
        filename: "dll-[name].min.js", //react.dll.js
        library: "_dll_[name]",
    },
    plugins: [
        new DllPlugin({
            name: "_dll_[name]",
            path: resolve("dll/dll-[name].manifest.json"),
        }),
    ],
    module: {
        rules: [
            {
                test: /\.(t|j)sx?$/,
                loader: 'babel-loader',
                exclude: /node_modules(?!.*(plain-utils|plain-loading|plain-popper).*)/,
            },
        ]
    }
};
